package com.matrix.admin.open.test.controller;

import com.matrix.admin.open.test.service.IHttpApiService;
import com.matrix.common.vo.basic.response.BaseResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liuweizhong
 * @since 2025-09-11 23:58
 */
@Tag(name = "开放Http接口测试接口", description = "开放Http接口测试接口")
@RestController
@RequestMapping("/open/http")
public class HttpApiTestController {

    @Resource
    private IHttpApiService httpApiService;


    @GetMapping("/test/get")
    @Operation(summary = "测试get", description = "测试get")
    public BaseResponse<String> get(@RequestParam(value = "url") String url) {
        return httpApiService.get(url);
    }

    @GetMapping("/test/post")
    @Operation(summary = "测试post", description = "测试post")
    public BaseResponse<String> post(@RequestParam(value = "url") String url, @RequestParam(value = "data") String data) {
        return httpApiService.post(url, data);
    }
}
